17. Exercise: Notifications

Notifications

INSTRUCTOR NOTE:

Notifications

In this exercise you'll create a button that triggers a notification.

Exercise Code

Exercise: T10.02-Exercise-CreateNotification

Notification Exercise

Now it's your turn. Run through the To-do's on your own.

SOLUTION:
  • Create a method that makes a `PendingIntent` which will open up the Hydration Reminder app.
  • Create a method that returns an appropriately sized icon for your notification.
  • Create a method called `remindUserBecauseCharging` that creates a notification telling the user to drink water.
  • Add a button which calls the `remindUserBecauseCharging` method.